/**
 * Created by haopengjie on 2016/10/13.
 */

$(function () {
    $('#submit-order').on('click', function () {
        
            $('#confirm').confirm({
                divContent : '.confirm-info'
            });
            $('.confirm-info-btn').on('click', function () {
                $('.confirm-show').css({background:'rgba(0,0,0,0)',zIndex:'-1'}).find('.confirm-info').hide();
            });
    });
});

//弹框
(function ($) {
    $.fn.confirm = function (opt) {
        var defaults = {
            pDiv : '.confirm-show',
            divContent : ''
        };
        var options = $.extend({},defaults,opt);
        return this.each(function () {
            var _this = $(this);
            var  winH = window.innerHeight;
            _this.find(options.pDiv).css({
                'height': winH,
                'zIndex': '98',
                'background': 'rgba(0,0,0,0.6)'
            }).find(options.divContent).show();
            $(window).scrollTop(0);
            $(window).scroll(function () {
                _this.find(options.pDiv).css({
                    'position':'fixed',
                    'top': '0'
                });
            });
        });
    }
})(jQuery);
